import json
class UserInfo:
    def __init__(self, id, username, email, registration_date):
        self.id = id
        self.username = username
        self.email = email
        self.registration_date = registration_date
    def __str__(self):
        return f"User name: {self.id}, age: {self.username}, phone: {self.email}, registration_date: {self.registration_date}"
#读取json.txt中的信息
list = []
with open('C:/Users/admin/Desktop/json.txt', 'r', encoding='utf-8') as f:
    line = f.read()
    users = json.loads(line)
    for user in users:
        list.append(UserInfo(user['id'], user['username'], user['email'], user['registration_date']))
# 遍历列表输出所有的用户信息
for user in list:
    print(user)